<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2020/12/23
 * Time: 20:41
 */
namespace app\api\controller;

use think\Db;
class Procate
{
    /**
     * @api {get} api\procate\procate 获取产品分类
     * @apiGroup Group
     * @apiDescription 获取产品分类
     * @apiSuccess {String} id 产品分类id
     * @apiSuccess {String} name 产品分类名称
     * @apiSuccessExample 数据:
     * {
    "code": 200,
    "mag": "请求成功",
    "data": [
    {
    "id": 1,
    "name": "LM滚动导轨",
    }
    ]
    },
     */
    public function procate(){
        $data=Db::name('pro_cate')
            ->field('id,name')
            ->select();
        if($data){
            return json(['code'=>200,'mag'=>"请求成功",'data'=>$data]);
        }else{
            return json(['code'=>0,'mag'=>"请求失败"]);
        }
    }

}